home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / sos3-2.lha / src / agg / Collection_scp.c < prev    next >
C/C++ Source or Header  |  1992-01-23  |  2KB  |  51 lines

  1. #line 1 "/fzi/prost/stone/SOS3-2/src/agg/Collection.c"
  2. /* --------------------------------------------------------------------------
  3.  * Copyright 1992 by Forschungszentrum Informatik (FZI)
  4.  *
  5.  * You can use and distribute this software under the terms of the licence
  6.  * you should have received along with this program.
  7.  * If not or if you want additional information, write to
  8.  * Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
  9.  * D-7500 Karlsruhe 1, Germany.
  10.  * --------------------------------------------------------------------------
  11.  */
  12. // **************************************************************************
  13. // Module Collection                30/06/89           Bernhard Schiefer (bs)
  14. //                                                   modified : 24/01/90 (bs)
  15. // **************************************************************************
  16. // implements methods of classes: Collection
  17. // **************************************************************************
  18.  
  19. #include "sys.h"
  20. #include "agg_err.h"
  21. #include "trc_agg.h"
  22.  
  23. #include "agg_sos.h"
  24.  
  25. // **************************************************************************
  26. sos_Bool _sos_Object_Collection::is_element (sos_Typed_id &_tpid,sos_Object o)
  27. // **************************************************************************
  28. {
  29.    // The function tests if an object is an element of the aggregate.
  30.    // The test may be based on equality or identity, depending on
  31.    // the value of the "based_on_equal" attribute.
  32.  
  33.    T_PROC ("sos_Object_Collection::is_element");
  34.    TT (agg_H, T_ENTER);
  35.  
  36.    sos_Bool result = FALSE;
  37.    sos_Object_Collection c = sos_Object_Collection::make(_tpid,this);
  38.    sos_Bool based_on_equal = sos_Object_Collection::make(_tpid,this).get_based_on_equal();
  39.  
  40.    agg_iterate (c, sos_Object elem)
  41.    {  if (agg_same_entity (o, elem, based_on_equal, EQ_STRONG))
  42.       {  result = TRUE;
  43.      break;
  44.       }
  45.    }
  46.    agg_iterate_end (c, elem);
  47.  
  48.    TT (agg_H, T_LEAVE);
  49.    return result;
  50. } // ** is_element **
  51.